﻿@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <title>相册</title>
    <link href="@Url.Content("~/Areas/User/Css/all2.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Areas/User/Css/shop.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/JS/jquery.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/artDialog/artDialog.js?skin=chrome")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/artDialog/plugins/iframeTools.source.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/artDialog/dialogHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/artDialog/artDialog.source.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/JS/Gallery.js")" type="text/javascript"></script>
</head>
<body>
    <div class="rightbar mt10">
        <ul class="tittab">
            <span class="orange-btn fd-right"><a href="###" onclick="AddAlbum()">新建相册</a></span>
            <li class="tcurrent"><a hidefocus="">管理相册</a></li>
            <li><a hidefocus="" href="/User/Images/ImgUploadBatch">上传图片</a></li>
        </ul>
        <ul class="phoshow">
   @foreach (var single in @Model.Rows)
            {
                    <li>
                        <li class="phone"><a href="/User/Images/AlbumInfo?id=@single["Id"]">
                            <img src="@Common.GDI.ResizeImage(single["FrontCover"].ToString(),100)" width="100"
                                height="100" /></a>
                            <ul class="pro-operation2 blue">
                                <li class="pl"><a hidefocus="" href="###" onclick="Update(@single["Id"])"><span
                                    class="pedit">修改</span></a></li>
                                <li><a hidefocus="" href="###" onclick="Delete(@single["Id"],@single["ImgCount"])">
                                    <span class="delect">删除</span></a></li>
                            </ul>
                            <div class="blue">
                                <b>
                                    @single["Name"]</b><span class="gray">(@single["ImgCount"])</span></div>
                            <span class="gray ari11">
                                @Common.TypeParse.ObjectToDateTime(single["CreateTime"],DateTime.Now).ToString("yyyy-MM-dd")</span>
                        </li>
                    </li>
                }
        </ul>
</div>
<script type="text/javascript">
             function Update(value) {
                 window.location = "/User/Images/AlbumInfo?id=" + value;
             }
             function AddAlbum() {
                 var option = { id: '1231' };
                 jQuery.dialogHelper.open("/User/Images/AlbumEdit", option);
             }
             function Delete(value, imgNum) {
                 if (imgNum != 0) {
                     jQuery.dialogHelper.alert("相册内有" + imgNum + "张图片，不能直接删除", "alert");
                 }
                 else {
                     jQuery.dialogHelper.confirm('您确定要删除吗？', 'DeleteExec(' + value + ')', 'cancel');
                 }
             }
             function DeleteExec(value) {
                 $.ajax({
                     type: "POST",
                     url: "/Images/Album",
                     data: { "id": value },
                     cache: false,
                     dataType: "text",
                     error: function () {
                         jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");
                     },
                     success: function (msg) {
                         jQuery.dialogHelper.alert(msg, "success", "okSuccess");
                     }
                 });
             }
             //删除成功
             function okSuccess() {
                 $.dialogHelper.close();
                 location.reload();
             }
             function AlbumEdit() {
                 $.ajax({
                     type: "POST",
                     url: "/User/Images/AlbumEdit",
                     data: { "albumName": $("#txt_AlbumName").val() },
                     dataType: "text",
                     success: function (result) {
                         jQuery.dialogHelper.close(1231);
                         if (result.indexOf("成功") != -1) {
                             jQuery.dialogHelper.alert(result, "success", "okSuccess");  //状态包括:success,smile,alert
                         } else {
                             jQuery.dialogHelper.alert(result, "alert");
                         }
                     },
                     error: function () {
                         jQuery.dialogHelper.close(1231);
                         jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");
                     }
                 });
             }
    </script>
</body>
</html>
